import { Component, OnInit, Input, Output, EventEmitter, HostBinding, HostListener, ChangeDetectionStrategy} from '@angular/core';
import {cardAnim} from "../../anims/card.anim";

@Component({
  selector: 'app-project-item',
  templateUrl: './project-item.component.html',
  styleUrls: ['./project-item.component.scss'],
  animations:[cardAnim],
  changeDetection:ChangeDetectionStrategy.OnPush
})
export class ProjectItemComponent implements OnInit {

  @Input() item;
  @Output() onInvite = new EventEmitter<void>();
  @Output() onEdit = new EventEmitter<void>();
  @Output() onDel = new EventEmitter<void>();
  // 动画
  @HostBinding('@card') cardState = 'out'
  constructor() { }

  // 鼠标移入
  @HostListener('mouseenter')
  onMouseenter(){
    this.cardState = 'hover';
  }
  // 鼠标移除
  @HostListener('mouseleave')
  onMouseleave(){
    this.cardState = 'out';
  }

  ngOnInit() {
  }
  // 邀请
  onInviteClick(){
    this.onInvite.emit();
  }
  // 编辑
  onEditClick(){
    this.onEdit.emit();
  }
  // 删除
  onDelClick(){
    this.onDel.emit()
  }

}
